#include "Key.h"
#include "Led.h"
#include "main.h"

static _led_toggle(void)
{
    HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
}

void led_task_runnable(void)
{
    static int s_nCnt, s_statu;
    KEY_STATU ks = get_key_statu();
    if (KEY_DOWN == ks)
    {
        s_statu = 1;
    }
    else
    {
        s_statu = 0;
    }

    if (1 == s_statu)
    {
        s_nCnt++;
    }
    else
    {
        if (s_nCnt >= LED_FLIP_TIME)
        {
            _led_toggle();
        }
        s_nCnt = 0;
    }
}

